package com.newtouch.avmarketing.mgr.modules.avmarkrting.api;


import com.newtouch.avmarketing.mgr.modules.avmarkrting.entity.MeetIngInfo;
import com.newtouch.avmarketing.mgr.modules.avmarkrting.model.MeetIngInfoCondition;
import com.newtouch.avmarketing.mgr.modules.avmarkrting.model.Result;
import com.newtouch.avmarketing.mgr.modules.avmarkrting.model.ResultCodes;
import com.newtouch.avmarketing.mgr.modules.avmarkrting.service.MeetIngService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@Api(value = "10 会议API", tags = "10 会议")
@Slf4j
@RestController
@RequestMapping("/api/meeting")
@CrossOrigin
public class MeetingApi {

    @Autowired
    MeetIngService meetIngService;

    @ApiOperation("会议列表")
    @PostMapping(value = "/meetingList")
    public Result findMeetingsByOprator(@ApiParam("opratorNo")  @RequestBody String originator_no, int page, int num) {
        try {
            Page<List<MeetIngInfo>> mrrtingList = meetIngService.findMeetingsByOprator(originator_no, page, num);
            return Result.of(ResultCodes.SUCCESS_CODE,"查询成功！",mrrtingList);
        }catch(Exception e) {
            log.error("查询会议列表失败",e);
        }
        return Result.of(ResultCodes.ERROR_CODE,"查询会议列表失败");
    }

    @ApiOperation("条件查询视频记录信息")
    @PostMapping("/findMeetIngInfo")
    public Result findMeetIngInfo(@RequestBody MeetIngInfoCondition doubleAuditingCondition){
        try {
            Page<MeetIngInfo> list = meetIngService.findMeetIngInfo(doubleAuditingCondition);
            if (null != list){
                return Result.of(ResultCodes.SUCCESS_CODE,"查询成功! ",list);
            }
        }catch (Exception e){
            log.error("错误信息：",e);
        }
        return Result.of(ResultCodes.ERROR_CODE,"查询失败! ");
    }

}
